package enduringLink.call;

import enduringLink.MyProxy;
import enduringLink.RequestHandler;
import instance.LocalInstance;
import io.netty.channel.Channel;

//查询开始对象，用于在RPC调用中传递开始查询的信息
public class MyStartSelect implements StartSelect{
    @Override
    public void select() {
        System.out.println("开始查询......");
        selectQuantitySum();
    }

    //查询的开始需要将当前实例的销售总量汇总到负责控制的实例中
    public void selectQuantitySum(){
        Channel channel = RequestHandler.getChannel();
        MyProxy myProxy = new MyProxy(channel);
        QuantityHandle quantityHandle = myProxy.proxyGet(QuantityHandle.class);
        quantityHandle.addQuantity(LocalInstance.getQuantitySum());
    }
}
